//
//  AnimalViewController.m
//  UILbrary
//
//  Created by mac on 16/8/16.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "AnimalViewController.h"
#import "LayerAnimalViewController.h"
#import "ClockAnimalViewController.h"
@interface AnimalViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *listTableView;
@property (nonatomic, strong) NSArray *titleArr;

@end

@implementation AnimalViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self.listTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"AnimalViewControllerCell"];
}

- (NSInteger )tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.titleArr.count;
}

- (CGFloat )tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 65.0;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AnimalViewControllerCell"];
    cell.textLabel.text = self.titleArr[indexPath.row];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row ==0) {
        [self.navigationController pushViewController:[LayerAnimalViewController new] animated:YES];
    }if (indexPath.row == 1) {
        [self.navigationController pushViewController:[ClockAnimalViewController new] animated:YES];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


#pragma mark - lazy
- (NSArray *)titleArr{
    
    if (!_titleArr) {
        _titleArr  = @[@"layer简单动画",@"表盘动画"];
    }
    return _titleArr;
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
